<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript">
	$(function() {
		var askId = "${ask.id}";
		if(askId!=null) {
			var ids = "${userIds}";
			$.each($("input[name='userIds']"),function(i, n){
				var value = $(n).val();
				var index = ids.indexOf(value);
				if(index!=-1) $(n).attr("checked", "checked");
			})
		}
	})
</script>
<form id="ask-form">
	<h3 class="thin underline">咨询信息</h3>
	<input type="hidden" name="ask.id" value="${ask.id }">
	<p class="inline-label button-height">
		<label class="label">标题：</label>
		<input type="text" name="ask.title" class="input" value="${ask.title }">
	</p>
	<p class="inline-label button-height">
		<label class="label">内容：</label>
		<textarea name="ask.text" class="input full-width autoexpanding" style="height:100px;">${ask.text }</textarea>
	</p>
	<div class="inline-label button-height" id="user-p">
		<label class="label">提给：</label>
		<fieldset class="fieldset">
			<legend class="legend">教师</legend>
			<c:forEach items="${teachers }" var="teacher">
				<input type="checkbox" name="userIds" value="${teacher.id }"> 
				<label for="radio-1" class="label">${teacher.username }</label>
			</c:forEach>
		</fieldset>
		<fieldset class="fieldset">
			<legend class="legend">专家</legend>
			<c:forEach items="${experts }" var="expert">
				<input type="checkbox" name="userIds" value="${expert.id }"> 
				<label for="radio-1" class="label">${expert.username }</label>
			</c:forEach>
		</fieldset>
	</div>
</form>
